package com.xxy.crm.controller;

import com.github.pagehelper.PageInfo;
import com.xxy.crm.base.BaseController;
import com.xxy.crm.query.CustomerOrderQuery;
import com.xxy.crm.service.CustomerOrderService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sun.dc.pr.PRError;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@Controller
@RequestMapping("order")
public class CustomerOrderController extends BaseController {
    @Resource
    private CustomerOrderService customerOrderService;

    /**
     * 分页查询
     * @param customerOrderQuery
     * @return
     */
    @RequestMapping("list")
    @ResponseBody
    public Map<String,Object> queryCustomerOrderByParams(CustomerOrderQuery customerOrderQuery){
        return customerOrderService.queryCustomerOrderByParams(customerOrderQuery);
    }

    /**
     * 订单详情页面跳转
     * @param orderId
     * @param request
     * @return
     */
    @RequestMapping("toOrderDetailPage")
    public String toOrderDetailPage(Integer orderId, HttpServletRequest request){
        Map<String,Object> map = customerOrderService.selectByOrderId(orderId);
        request.setAttribute("order",map);
        return "customer/customer_order_detail";
    }

}
